package com.microservice.salmon.db.entities;

import com.salmon.common.tree.ITree;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Table(name = "t_goods_category")
@Data
@EqualsAndHashCode(of = "id")
public class GoodsCategory implements ITree {
    private static final long serialVersionUID = -3593122697159188498L;
    /**
     * 自增ID
     */
    @Id
    private Integer id;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 父ID
     */
    @Column(name = "parent_id")
    private Integer parentId;

    /**
     * 商品佣金比例 -1代表使用上级父类的佣金设置
     */
    @Column(name = "commission_rate")
    private BigDecimal commissionRate;

    /**
     * 分类的图片
     */
    private String img;

    /**
     * 子标题
     */
    @Column(name = "sub_title")
    private String subTitle;

    /**
     * 分类简称
     */
    @Column(name = "simple_name")
    private String simpleName;

    /**
     * 是否显示 0:隐藏 1:显示
     */
    @Column(name = "is_show")
    private Boolean isShow;

    /**
     * 是否显示楼层 0:不显示 1:显示
     */
    @Column(name = "is_floor")
    private Boolean isFloor;

    /**
     * 排序号
     */
    @Column(name = "cat_sort")
    private Integer catSort;

    /**
     * 删除标志 1:有效 0：删除
     */
    @Column(name = "data_flag")
    private Boolean dataFlag;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    @Transient
    private List<ITree> children;

}